package com.fhz.big

import android.content.SharedPreferences

/**
 * 时间:2023/4/7
 * @author Mr.Feng
 * 简述: TODO
 */

var content: String? = "hello"
fun main(){

    val example1 = example1(::min)
    println(example1)
    "".aa()


    val build = StringBuilder().build {
        append(1)
        append(2)
    }
    build.append(3)
    "".apply {

    }
    val abc = StringBuffer().abc {
        append(1)
    }
    abc.append(12)


    val stringUp = StringUp()
    stringUp.s = "egeggegegegegegeg" //set
    println(stringUp.s) //get


}
inline fun StringBuffer.abc(a: StringBuffer.() -> Unit):StringBuffer{
    a()
    return this
}


//函数 类型
fun example1(func: (Int,Int) -> Int)  : Int {
    val func1 = func(1,1)
    return func1
}

fun add(a:Int,b:Int) : Int{
    return a + b
}
fun min(a:Int,b:Int) :Int {
    return a - b
}

inline fun StringBuilder.build(block: StringBuilder.() -> Unit): StringBuilder {
    block()
    return this
}

fun String.aa(){

}

fun SharedPreferences.abc(block: SharedPreferences.Editor.() -> Unit){
    val edit = edit()
    edit.block()
    edit.apply()
}

